<?php
/**
 * @author Micheal Luthor
 */

class Command {
	/**
	 * @var array
	 */
	public $arguments;
	/**
	 * @var integer
	 */
	public $argumentsCount;
	/**
	 * @var mixed
	 */
	public $result;

	/**
	 * @return unknown
	 */
	function __construct(){
		$this->arguments = array();
		$this->argumentsCount = 0;
		
		$className = get_class($this);
		$resultClass = $className.'Result';
		X::import('Application.CommandRunner.'.$className.'.'.$resultClass);
		$this->result = new $resultClass();
		
		return $this;
	}
	/**
	 * @param unknown_type $paramString
	 */
	public function parserParamString($paramString = ''){
		return $this;
	}
	
	/**
	 */
	public function run(){}
	
	/**
	 * @param string $format
	 * @return 
	 */
	public function show($format='text'){
		$className = get_class($this);
		
		$shower = $className.'ShowAs'.ucfirst($format);
		X::import('Application.CommandRunner.'.$className.'.'.$shower);
		
		$shower = new $shower($this->result);
		$shower->show();
		
		return $this;
	}
}